package com.sc.ktapplication.module.activity

import android.app.Application
import androidx.lifecycle.MutableLiveData
import androidx.lifecycle.viewModelScope
import com.sc.ktapplication.common.base.BaseViewModel
import com.sc.ktapplication.common.constant.AppConstant
import kotlinx.coroutines.launch
import java.lang.Exception

class UpdatePwdViewModel(application: Application) : BaseViewModel(application) {

    val updateRet = MutableLiveData<Boolean>()

    fun updatePwd(param : MutableMap<String,Any>){
        viewModelScope.launch {
            try {
                val ret = webApi.updatePwd(param)
                if(ret.isSuccess){
                    updateRet.postValue(ret.obj)
                }else{
                    errorMsg.postValue(ret.errorMsg)
                }
            }catch (e :Exception){
                e.printStackTrace()
                errorMsg.postValue(AppConstant.NET_ERROR)
            }
        }



    }

}